'''
Created on 2011-04-13

@author: jasisz
'''
import unittest
from gameObjects import *
import random


class GameObjectsTest(unittest.TestCase):
    
    def testResourceSanity(self):
        names = ["dupa", "elo", "sraka", "klonowanie"]
        values = ["japka", 7, 2.0, "badziak"]
        res = Resource("test")
        for i in range(random.randint(5,100)):
            res.setProperty(random.choice(names), random.choice(values))
        repr = yaml.dump(res, default_flow_style=False)
        res2 = yaml.load(repr)
        repr2 = yaml.dump(res2, default_flow_style=False)
        self.assertEqual(repr, repr2)
        repr = yaml.dump(res, default_flow_style=True)
        res2 = yaml.load(repr)
        repr2 = yaml.dump(res2, default_flow_style=True)
        self.assertEqual(repr, repr2)
        res2.setProperty("elo", 3)
        repr2 = yaml.dump(res2, default_flow_style=True)
        self.assertNotEqual(repr, repr2)
        


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testName']
    unittest.main()